<?php
require_once 'application/library/view/gcViewSmarty.php';
require_once 'application/library/config/gcConfigRegistry.php';
require_once 'application/library/helper/sessionHelper.php';
require_once 'application/constant/constant.php';
require_once 'Zend/Loader.php';

Zend_Loader::loadClass('Zend_Controller_Action' );
/** 
 * gcErrorAction
 * @author    Soochow University
 * @version   1.0
 * @exclude   作  成  日：2011/04/07
 */
class gcErrorAction extends Zend_Controller_Action{
    
    /**
     *view 
     */
    protected $Error_view;
    
    /**
     * $translate
     */
    protected $gcTranslate;

    /**
     * 初期化
     * init
     * @return
     */
    public function init(){
        $this->translate=$this->loaderTranslate();
        $templatPath=sysConstant::MODULES_PATH."default".sysConstant::VIEWS_DIRECTORY;
        $this->Error_view=new gcViewSmarty($templatPath);
        $this->Error_view->passwordEdit = $this->gcTranslate->translate("passwordEdit");
        $this->Error_view->logout       = $this->gcTranslate->translate("logout");
        $this->Error_view->topLabel     = $this->gcTranslate->translate("topLabel");
        $this->Error_view->host         = configHelper::getHostServer();
        $this->Error_view->theme        = sessionHelper::getTheme();
   
    }
  
    /**
     * 国际化
     * loaderTranslate
     */
    private function loaderTranslate(){
        $moduleName=$this->getRequest()->getModuleName();
        $localLanguage=configHelper::getLocalLanguage();
        $options = array('adapter' => "tmx",
                         'content' => sysConstant::MODULES_PATH.$moduleName.sysConstant::LANGUAGES_DIRECTORY,
                         'locale'  => $localLanguage);
        $translate=new Zend_Translate($options);
        $translate =unserialize(gcConfigRegistry::get(sysConstant::SYS_TRANSLATE));
        $translate->addTranslation($options);

        $this->gcTranslate=$translate->getAdapter();
    }
    
    /**
     * 标签取得
     * getLabel
     * @param   string  $labelId
     */
    protected function getLabel($labelId){
        $strLabe = $this->gcTranslate->translate($labelId);
        return $strLabe;
    }
}